'use strict';
app.controller('memberTransactionHistoryCtrl',['$scope','toaster','utilService','$filter','memberTransactionHistoryService',function($scope,toaster,utilService,$filter,memberTransactionHistoryService){
    $scope.memberCardHistoryVO={
        startTime:new Date().getFullYear()+"-"+(new Date().getMonth()+1)+"-01",
        endTime:$filter('date')(new Date(),'yyyy-MM-dd')
    };
    $scope.queryForTotal=function(){
        memberTransactionHistoryService.findForTotal($scope).then(function(rlt){
            switch (rlt.status) {
                case 200:
                    $scope.headerData = rlt.data;
                    $scope.headerData.time=new Date();
                    break;
                default :
                    toaster.pop('error', "操作失败", "发生未知错误！请联系管理员");
                    break;
            }
        });
    };
    $scope.queryForTotal();

    $scope.queryForList=function(){
        $scope.memberCardHistoryVO.startTime=$filter('date')($scope.memberCardHistoryVO.startTime,'yyyy-MM-dd');
        $scope.memberCardHistoryVO.endTime=$filter('date')($scope.memberCardHistoryVO.endTime,'yyyy-MM-dd');
        utilService.queryForPagingList($scope,{
            url:$scope.app.domain+'/member/card/history',
            params:$scope.memberCardHistoryVO
        }).then(function(rlt) {
        });
    };
    $scope.queryForList();

}]);